﻿namespace SupportSystemDB
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Provides a descriptive result to the login process.
    /// </summary>
    public enum LogInResults
    {
        /// <summary>
        /// User Name Not Found.
        /// </summary>
        [Description( "Username not found." )]
        UserNameNotFound = 1 ,

        /// <summary>
        /// Wrong Password.
        /// </summary>
        [Description( "Wrong passowrd." )]
        WrongPassword = 2 ,

        /// <summary>
        /// You are Not an Active Member of This Year.
        /// </summary>
        [Description( "Not an active member." )]
        NotActive = 3 ,

        /// <summary>
        /// You are Successfully Logged In.
        /// </summary>
        [Description( "You are successfully logged in." )]
        LogInSucceeded = 4 ,

        /// <summary>
        /// Log In Error.
        /// </summary>
        [Description( "Log in error." )]
        Error = 0
    }

    /// <summary>
    /// Extension Methods Class
    /// </summary>
    public static class ExtensionMethods
    {
        /// <summary>
        /// Gets the description.
        /// </summary>
        /// <param name="enumerator">The enumerator.</param>
        /// <returns>Description of The Enumerator Value</returns>
        public static string GetDescription( this Enum enumerator )
        {
            return (Attribute.GetCustomAttribute(enumerator.GetType().GetField( enumerator.ToString() ) ,typeof( DescriptionAttribute ) ) as DescriptionAttribute).Description;
        }
    }
}
